package com.example.mybaiduweishi.activity;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.content.Intent;
import android.os.Bundle;
import android.widget.RelativeLayout;

import com.example.mybaiduweishi.R;
import com.example.mybaiduweishi.activity.base.BaseActivity;
import com.example.mybaiduweishi.services.MyLoadNewVersionService;

import butterknife.BindView;

public class WelcomeActivity extends BaseActivity {


    @BindView(R.id.activity_welcome)
    RelativeLayout activityWelcome;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public int getContentXML() {
        return R.layout.activity_welcome;
    }

    @Override
    public void initData() {

    }

    @Override
    public void initView() {
        ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(activityWelcome, "alpha", 1f, 0f);
        objectAnimator.setDuration(3000);//延迟
        objectAnimator.start();
        //监听
        objectAnimator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                //跳回主页面
                startActivity(new Intent(WelcomeActivity.this, MainActivity.class));
                finish();
                overridePendingTransition(R.anim.out_to_left, R.anim.in_to_right);
            }
        });
    }
}
